package com.zatech.cgnci.project.controller;


import com.zatech.cgnci.project.service.CgnciClaimBasisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 理赔基础表 前端控制器
 * </p>
 *
 * @author Generator
 * @since 2024-12-17
 */
@RestController
@RequestMapping("/api/claim-basis")
@RequiredArgsConstructor
@Api(produces = "application/json", tags = "理赔基础api接口文档")
public class CgnciClaimBasisController {

    private final CgnciClaimBasisService claimBasisService;

    @GetMapping("/deleteById")
    @ApiOperation(value = "删除")
    public void deleteById(@RequestParam(value = "basisId") Long basisId) {
        claimBasisService.removeById(basisId);
    }

    @GetMapping("/deleteByIds")
    @ApiOperation(value = "批量删除")
    public void deleteByIds(@RequestParam(value = "basisIds") String basisIds) {
        List<Long> basisIdList = Arrays.stream(basisIds.split(",")).map(Long::valueOf).collect(Collectors.toList());
        claimBasisService.removeByIds(basisIdList);
    }

}

